package com.weigang.dynamic.datasource.controller;

import com.weigang.dynamic.datasource.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class HrUserController {
    @Resource
    private UserService userService;

    @GetMapping(value = "/getUsers")
    public void getUsers(){
        String userToMaster = userService.getUserToMaster(1);
        System.out.println("userToMaster-->" + userToMaster);
        String userFromSlave = userService.getUserFromSlave(1);
        System.out.println("userFromSlave-->" + userFromSlave);
    }
}
